/*
import 'package:flame/components.dart';
import 'package:flame_bloc/flame_bloc.dart';
import 'package:flutter/material.dart';
import 'package:flutter_flame/bloc/game_bloc/GameBloc.dart';
import 'package:flutter_flame/bloc/game_bloc/GameState.dart';
import 'package:flutter_flame/routes/RouteGame.dart';
import '../../../config/GameConfig.dart';

class NowSunlightText extends TextComponent
    with GameConfig, HasGameReference<RouterGame> {
  @override
  Future<void> onLoad() async {
    final style = TextStyle(color: Colors.black, fontSize: 20);
    text = "${game.bloc.state.sunlight}";
    position = nowSunPosition;
    size = Vector2(100, 100);
    anchor = Anchor.center; // 让文本在自身范围内居中
    textRenderer = TextPaint(style: style);
    add(
      FlameBlocListener<GameBloc, GameStatesState>(
        bloc: game.bloc,
        onNewState: (state) {
          text = "${state.sunlight}";
        },
      ),
    );
    return super.onLoad();
  }
}
*/
